<template>
  <div :class="['plan', 'create-cp', isCurrentPlanShow?'create-cp__finish':'']" class="public_finish">
    <div class="create-cp-li con">
      <div class="lab">{{$t('customer.contactPlan.contactPlanContent')}}</div>
      <p>{{ planContent }}</p>
    </div>
    <div class="create-cp-li time">
      <div class="lab">{{$t('customer.contactPlan.contactPlanTime')}}</div>
      <p>{{ planTime }}</p>
    </div>
    <div class="create-cp-li time">
      <div class="lab">&nbsp;&nbsp;{{$t('customer.contactPlan.excute')}}</div>
      <p>{{ currExecutor }}</p>
    </div>
    <div class="btn-box">
      <el-button type="cancel" @click.stop="edit" class="primary_btn">{{ $t('public.edit2') }}</el-button>
      <el-button type="primary" @click.stop="deal" class="primary_btn">{{ $t('public.finish') }}</el-button>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'UpdateContactPlan',
    props: {
      executorNew: String,
      isCurrentPlanShow: Boolean,
      planTime: String,
      planContent: String
    },
    data () {
      return {
        agentObj: {}
      }
    },
    computed: {
      currExecutor () {
        if (this.executorNew) {
          return this.agentObj[this.executorNew] ? this.agentObj[this.executorNew].displayName || this.agentObj[this.executorNew].exten : ''
        } else {
          return ''
        }
      }
    },
    methods: {
      edit () {
        this.$emit('edit')
      },
      deal () {
        this.$emit('deal')
      }
    },
    created () {
      this.agentObj = {}
      let _arr = this.$getCache('agents')
      for (let i = 0; i < _arr.length; i++) {
        this.agentObj[_arr[i]._id] = _arr[i]
      }
    }
  }
</script>
<style lang="stylus" scoped>
@import '../../../../assets/common.styl'
.con,.time
  .lab
    color #595959
    display inline-block
  p
    display inline-block
    font-size 12px
    color $cf-gray0
    margin 0 0 0 28px
    vertical-align top
    width calc(100% - 130px)
    word-break break-all
  .deal
    text-decoration line-through
    margin-left 0
    color $cf-gray4
  span
    color $c-main
    width 120px
    text-align right
    font-size 12px
    cursor pointer
.fini
  color $cf-gray5
strong
  display inline-block
  width 22px
  height 22px
  position relative
  top 7px
  cursor pointer
  .iconfont
    font-size 18px
    color $c-main
.create-cp-li
  position relative
.create-cp-li+.create-cp-li
  margin-top 10px
.btn-box
  margin-top 10px
  text-align right
  .primary_btn
    display inline-block
.create-cp-li+.create-cp-li
  margin-top 10px
</style>
